package com.open.capacity.forum.feign.impl;

import com.open.capacity.common.model.FileInfo;
import com.open.capacity.common.web.Result;
import com.open.capacity.forum.feign.FileService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 蒋鑫
 * @version 2021/3/2
 * 文件上传远程调用服务降级
 */
@Slf4j
public class FileServiceFallback implements FallbackFactory<FileService> {

    @Override
    public FileService create(Throwable throwable) {
        log.error("user-center服务异常" + throwable);
        return new FileService() {
            @Override
            public FileInfo upload(MultipartFile file) throws Exception {
                return null;
            }
        };
    }
}
